var gulp = require('gulp'), 
    git = require('gulp-git'),
    argv = require('minimist')(process.argv.slice(2)),
    ftp = require('gulp-ftp');

/*拉取*/
gulp.task('pull',function(){
    git.pull('origin',['master','develop'],function(err){
        // if(err) throw err;
    });
});

/*添加*/
gulp.task('add',['pull'],function(){
    return gulp.src('.')
        .pipe(git.add())
});

/*提交*/
gulp.task('commit',['add'],function(){
    return gulp.src('.')
        .pipe(git.commit(argv.m,{emitData:true}))
        .on('data',function(data){
            console.log(data);
        });
});

/*推送*/
gulp.task('push',['commit'],function(){
    git.push('origin','master',function(err){
        // if(err) throw err;
    });
});

/*ftp上传test*/
gulp.task('ftp',['push'],function(){
    return gulp.src(['./**/*.*','!./App_Data/**/*.*','!./node_modules/**/*.*','!gulpfile.js','!package.json','!README.md','!website.publishproj'])
        .pipe(ftp({
            host:'10.1.26.12',
            user:'webresource',
            pass:'1qaz2wsx!',
            port:27,
            remotePath:'/test/'
        }))
});